/**
 * 
 */
package de.mbenning.fsim.persistence.base;

import org.hibernate.FlushMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.orm.hibernate3.SessionFactoryUtils;
import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;

/**
 * @author Martin.Benning
 *
 */
public class FlushingSpringSessionInViewFilter extends OpenSessionInViewFilter  {
	public FlushingSpringSessionInViewFilter() {
    }

    protected Session getSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException {
        Session session = SessionFactoryUtils.getSession(sessionFactory, true);
        session.setFlushMode(FlushMode.COMMIT);
        return session;
    }
}
